function [output] = Qgeneral2(lambda, p0)

m = 10000;
g = 9.8;

h = abs(p0)/m;

q = 0;
intGamma = 0;
for i = 1:m-1
	intGamma = intGamma - (feval(@gamma, (i-1)*h)+feval(@gamma, i*h))*h*0.5;
	q = q - 0.5*h/sqrt(lambda + 2*intGamma);
	next = intGamma - (feval(@gamma, (i)*h)+feval(@gamma, (i+1)*h))*h*0.5;
	q = q - 0.5*h/sqrt(lambda + 2*next);
end
i = m;
intGamma = intGamma - (feval(@gamma, (i-1)*h)+feval(@gamma, i*h))*h*0.5
q = q - h/sqrt(lambda + 2*intGamma);

output = -2*g*q + lambda;

end


